package com.gzsxy.esjy.service.core.sign.enums;

import lombok.Getter;

/**
 * <p>
 *
 * </p>
 *
 * @author zhangxiaolong
 * @date 2022/7/13 11:36
 */
@Getter
public enum SignFlowEnum {
    /**
     *0待审核。1待派出所签名 2待看守所签名 3待在押人员签名 4 待盖章 5待看守所提交 6待派出所提交 7已提交, 8-已取消
     */
    UNDEFINE(-1, "未知状态"),
    WAIT_VERIFY(0, "待审核"),
    POLICE_SIGN(1, "待派出所签名"),
    CARETAKER_SIGN(2, "待看守所签名"),
    PRISONER_SIGN(3, "待在押人员签名"),
    SEAL(4, "待盖章"),
    CARETAKER_COMMIT(5, "待看守所提交"),
    POLICE_COMMIT(6, "待派出所提交");

    private int code;
    private String name;

    SignFlowEnum(int code, String name){
        this.code = code;
        this.name = name;
    }

    /**
     * 通过流程状态获取枚举
     * @param state
     * @return
     */
    public static SignFlowEnum getByState(int state){
        for(SignFlowEnum s : values()){
            if(s.getCode() == state){
                return s;
            }
        }
        return UNDEFINE;
    }
}
